<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>如何检测当前浏览器上的插件</title>
</head>
<body>
  <script>
    console.log(navigator)
    let hasPlugin = (name) => {
      name = name.toLowerCase()
      for(let i=0;i<navigator.plugins.length;i++){
        if(navigator.plugins[i].name.toLowerCase().indexOf(name) > -1){
          return true
        }
        else{
          return false
        }
      }
    }
    alert(hasPlugin('Flash'))
    alert(hasPlugin('Chrome PDF Plugin'))
  </script>
</body>
</html>